package com.ftwj.demo.modular.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ftwj.demo.config.swagger.HttpMethod;
import com.ftwj.demo.modular.entity.SolrBean;
import com.ftwj.demo.modular.service.SolrService;
import com.ftwj.demo.utils.result.ResultBean;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController 
@RequestMapping("/solr")
@Api(tags="全文检索源管理接口", value="Solr信息增删改操作管理")
@Validated
public class SolrController {

	@Autowired
	private SolrService service;
	
	@GetMapping("load")
	@ApiOperation(value="测试Solr连接", notes="数据",code=0,httpMethod=HttpMethod.GET)
	public ResultBean<?> load() {
		service.load();
		return ResultBean.success();
	}
	
	@PostMapping("/insert")
	@ApiOperation(value="新增Solr信息", notes="数据",code=0,httpMethod=HttpMethod.POST)
	public ResultBean<?> insert(@RequestBody@Validated SolrBean entity){
		service.insert(entity);
		return ResultBean.success();
	}
}
